<?php 
namespace Home\Controller;



// 交易培训
class TrainController extends CommController{


	/**
	 * 文章列表页
	 * @return [type] [description]
	 */
	public function index(){
		switch (I('type')) {
			case 'noun':
				$this->type = 'noun';

				!$this->langs ? $this->typeTitle = '外汇名词解释':$this->typeTitle = 'Foreign exchange terminology';
				$type = '2';
				break;
			default:
				$this->type = 'basics';

				!$this->langs ? $this->typeTitle = '外汇基础知识':$this->typeTitle = 'Forex basics';
				$type = '1';
				break;
		}


		!$this->langs ? $zhOren = '_zh':$zhOren = $this->langs;
		$this->articleList = M('article')->field('title' . $zhOren . ' as title,id')->where(['article_type'=>$type])->order('add_time' , 'desc')->select();

		$this->display('index'.$this->langs);
	}



	/**
	 * 文章内容页
	 * @return [type] [description]
	 */
	public function forexList(){

		switch (I('type')) {
			case 'noun':
				$this->type = 'noun';
				
				!$this->langs ? $this->typeTitle = '外汇名词解释':$this->typeTitle = 'Foreign exchange terminology';
				$type = '2';
				break;
			default:
				$this->type = 'basics';

				!$this->langs ? $this->typeTitle = '外汇基础知识':$this->typeTitle = 'Forex basics';
				$type = '1';
				break;
		}


		if (I('get.aid')) {
			$aid = I('get.aid');
		}else{
			$this->error('无效参数！' , '/Home/Train/index');
		}

		!$this->langs ? $zhOren = '_zh':$zhOren = $this->langs;
		$this->upTitle = M('article')->field('title' . $zhOren . ' as title,id')->where(['article_type'=>$type,'id'=>['gt',$aid]])->find();
		$this->articleContent = M('article')->field('title' . $zhOren . ' as title,id,content'.$zhOren.' as content,add_time')->where(['article_type'=>$type,'id'=>$aid])->find();
		$this->nextTitle = M('article')->field('title' . $zhOren . ' as title,id')->where(['article_type'=>$type,'id'=>['lt',$aid]])->find();


		$this->display('forexList'.$this->langs);
	}





















}












 ?>